﻿using DongFangGuoKai.WMSPlatform.Commn.ApiResultModule;
using DongFangGuoKai.WMSPlatform.Domain;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace DongFangGuoKai.WMSPlatform.WebApi.Controllers.ExteriorInterface
{
    /// <summary>
    /// 取号
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class TakeNumberController : ApiBaseController
    {
        /// <summary>
        /// WCS测试临时使用的类
        /// </summary>
        /// <param name="orderSn">单号</param>
        /// <param name="winCode">窗口号</param>
        /// <param name="OutBoundNo">出库单</param>
        public record ResOrderSnWinNumber(string orderSn,string OutBoundNo, ushort winCode);
        /// <summary>
        /// wcs取窗号
        /// </summary>
        /// <param name="boxNumber">箱子号</param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetNumber(string? boxNumber)
        {

            ApiDataResult<ResOrderSnWinNumber> res = new ApiDataResult<ResOrderSnWinNumber>()
            {
                Code = 200,
                Msg = "OK",
                Data = new ResOrderSnWinNumber( new Random().Next(10000,99999).ToString(), new Random().Next(10000, 99999).ToString(), (ushort)new Random().Next(90,95 ))
            };

            //ApiDataResult<string> res = new ApiDataResult<string>()
            //{
            //    Code = 200,
            //    Msg = "OK",
            //    Data = "0002"
            //};
            return Ok(res);
        }


        /// <summary>
        /// wcs取任务类型
        /// </summary>
        /// <param name="taskCode">任务号</param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetTaskType(string taskCode)
        {
            ApiDataResult<string> res = new ApiDataResult<string>()
            {
                Code = 200,
                Msg = "OK",
                Data = "1"
            };
            return Ok(res);
        }
    }
}
